home *** CD-ROM | disk | FTP | other *** search
/ Hardcore Visual Basic 5.0 (2nd Edition) / Hardcore Visual Basic 5.0 - Second Edition (1997)(Microsoft Press).iso / Source / WinTlb / WINNETWK.IDL < prev    next >
Text File  |  1996-07-10  |  17KB  |  515 lines

  1. // Network API types, constants, and functions
  2.  
  3. typedef struct  NETRESOURCE {
  4.     DWORD    dwScope;
  5.     DWORD    dwType;
  6.     DWORD    dwDisplayType;
  7.     DWORD    dwUsage;
  8.     LPTSTR    lpLocalName;
  9.     LPTSTR    lpRemoteName;
  10.     LPTSTR    lpComment ;
  11.     LPTSTR    lpProvider;
  12. } NETRESOURCE;
  13.  
  14. typedef struct CONNECTDLGSTRUCT {
  15.     DWORD cbStructure;       // size of this structure in bytes
  16.     HWND hwndOwner;          // owner window for the dialog
  17.     // DWORD NETRESOURCE lpConnRes; // Requested Resource info
  18.     DWORD dwFlags;           // flags (see below)
  19.     DWORD dwDevNum;          // number of devices connected to
  20. } CONNECTDLGSTRUCT;
  21.  
  22. typedef struct UNIVERSAL_NAME_INFO {
  23.     LPTSTR    lpUniversalName;
  24. } UNIVERSAL_NAME_INFO;
  25.  
  26. typedef struct REMOTE_NAME_INFO {
  27.     LPTSTR    lpUniversalName;
  28.     LPTSTR    lpConnectionName;
  29.     LPTSTR    lpRemainingPath;
  30. } REMOTE_NAME_INFO;
  31.  
  32. typedef struct NETINFOSTRUCT {
  33.     DWORD cbStructure;
  34.     DWORD dwProviderVersion;
  35.     DWORD dwStatus;
  36.     DWORD dwCharacteristics;
  37.     DWORD dwHandle;
  38.     WORD  wNetType;
  39.     DWORD dwPrinters;
  40.     DWORD dwDrives;
  41. } NETINFOSTRUCT;
  42.  
  43. typedef struct DISCDLGSTRUCT {
  44.     DWORD cbStructure;      // size of this structure in bytes
  45.     HWND  hwndOwner;        // owner window for the dialog
  46.     LPTSTR lpLocalName;      // local device name
  47.     LPTSTR lpRemoteName;     // network resource name
  48.     DWORD dwFlags;          // flags
  49. } DISCDLGSTRUCT;
  50.  
  51. typedef struct NETCONNECTINFOSTRUCT {
  52.     DWORD cbStructure;
  53.     DWORD dwFlags;
  54.     DWORD dwSpeed;
  55.     DWORD dwDelay;
  56.     DWORD dwOptDataSize;
  57. } NETCONNECTINFOSTRUCT;
  58.  
  59. typedef LONG PFNPROCESSPOLICIES;
  60. // BOOL (FAR PASCAL *PFNPROCESSPOLICIESA) (
  61. //     HWND        hwnd,
  62. //     LPCTSTR    pszPath,
  63. //     LPCTSTR    pszUsername,
  64. //     LPCTSTR    pszComputerName,
  65. //     DWORD       dwFlags
  66. //    );
  67.  
  68.  
  69. typedef LONG PFNGETPROFILEPATH;
  70. //
  71. // typedef UINT (FAR PASCAL *PFNGETPROFILEPATHA) (
  72. //     LPCTSTR    pszUsername,
  73. //     LPTSTR     pszBuffer,
  74. //     UINT        cbBuffer
  75. //     );
  76.  
  77. typedef LONG PFNRECONCILEPROFILE;
  78. // typedef UINT (FAR PASCAL *PFNRECONCILEPROFILEA) (
  79. //     LPCTSTR    pszCentralFile,
  80. //     LPCTSTR    pszLocalFile,
  81. //     DWORD       dwFlags
  82. //     );
  83.  
  84. [
  85. #ifdef UNICODE
  86. uuid(64675050-3A82-101B-8181-00AA003743D3),
  87. #else
  88. uuid(64674050-3A82-101B-8181-00AA003743D3),
  89. #endif
  90. helpstring("Networks"),
  91. dllname("MPR.DLL")
  92. ]
  93. module Network {
  94.     
  95.     // Errors
  96.     [ helpstring("WNet: Function succeeded") ]
  97.     const UINT WN_SUCCESS           = 0x0000;
  98.     [ helpstring("WNet: Function not supported") ]
  99.     const UINT WN_NOT_SUPPORTED     = 0x0001;
  100.     [ helpstring("WNet: Network error") ]
  101.     const UINT WN_NET_ERROR         = 0x0002;
  102.     [ helpstring("WNet: Buffer too small") ]
  103.     const UINT WN_MORE_DATA         = 0x0003;
  104.     [ helpstring("WNet: A pointer value was invalid") ]
  105.     const UINT WN_BAD_POINTER       = 0x0004;
  106.     [ helpstring("WNet: Local name invalid") ]
  107.     const UINT WN_BAD_VALUE         = 0x0005;
  108.     [ helpstring("WNet: Invalid password") ]
  109.     const UINT WN_BAD_PASSWORD      = 0x0006;
  110.     [ helpstring("WNet: A security violation occurred") ]
  111.     const UINT WN_ACCESS_DENIED     = 0x0007;
  112.     [ helpstring("WNet: The requested resource is in use") ]
  113.     const UINT WN_FUNCTION_BUSY     = 0x0008;
  114.     [ helpstring("WNet: Unexpected error") ]
  115.     const UINT WN_WINDOWS_ERROR     = 0x0009;
  116.     [ helpstring("WNet: Invalid user") ]
  117.     const UINT WN_BAD_USER          = 0x000A;
  118.     [ helpstring("WNet: System out of memory") ]
  119.     const UINT WN_OUT_OF_MEMORY     = 0x000B;
  120.     [ helpstring("WNet: Canceled by user") ]
  121.     const UINT WN_CANCEL                = 0x000C;
  122.     [ helpstring("WNet: Continued by user") ]
  123.     const UINT WN_CONTINUE          = 0x000D;
  124.  
  125.     // Connection errors
  126.     [ helpstring("WNet: Network connection does not exist") ]
  127.     const UINT WN_NOT_CONNECTED     = 0x0030;
  128.     [ helpstring("WNet: Files are open, but force not specified") ]
  129.     const UINT WN_OPEN_FILES            = 0x0031;
  130.     [ helpstring("WNet: Remote name invalid or already connected") ]
  131.     const UINT WN_BAD_NETNAME       = 0x0032;
  132.     [ helpstring("WNet: Local name invalid") ]
  133.     const UINT WN_BAD_LOCALNAME     = 0x0033;
  134.     [ helpstring("WNet: Local device already in use") ]
  135.     const UINT WN_ALREADY_CONNECTED = 0x0034;
  136.     [ helpstring("WNet: Device not functioning") ]
  137.     const UINT WN_DEVICE_ERROR      = 0x0035;
  138.     [ helpstring("WNet: Device not currently connected, but is a remembered connection") ]
  139.     const UINT WN_CONNECTION_CLOSED = 0x0036;
  140.  
  141.     // ****** Network support *******
  142.  
  143.     [
  144.     usesgetlasterror,
  145.     #ifdef UNICODE
  146.     entry("WNetAddConnectionW"),
  147.     #else
  148.     entry("WNetAddConnectionA"),
  149.     #endif
  150.     helpstring("Redirects a local device to a shared devices or remote server"),
  151.     ]
  152.     UINT WINAPI WNetAddConnection(LPTSTR lpszNetPath,
  153.                                   LPTSTR lpszPassword,
  154.                                   LPTSTR lpszLocalName);
  155.  
  156.     [
  157.     usesgetlasterror,
  158.     #ifdef UNICODE
  159.     entry("WNetGetUserW"),
  160.     #else
  161.     entry("WNetGetUserA"),
  162.     #endif
  163.     helpstring("Gets the user name"),
  164.     ]
  165.     UINT WINAPI WNetGetUser(LPTSTR lpszBuffer,
  166.                             UINT * cbBuffer);
  167.  
  168.     [
  169.     usesgetlasterror,
  170.     #ifdef UNICODE
  171.     entry("WNetGetConnectionW"),
  172.     #else
  173.     entry("WNetGetConnectionA"),
  174.     #endif
  175.     helpstring("Gets the name of the shared devices associated with the given local device"),
  176.     ]
  177.     UINT WINAPI WNetGetConnection(LPTSTR lpszLocalName,
  178.                                   LPTSTR lpszRemoteName,
  179.                                   UINT * cbRemoteName);
  180.  
  181.     [
  182.     usesgetlasterror,
  183.     #ifdef UNICODE
  184.     entry("WNetCancelConnectionW"),
  185.     #else
  186.     entry("WNetCancelConnectionA"),
  187.     #endif
  188.     helpstring("Cancels a network connection device, forcing open connections to close if fForce is true"),
  189.     ]
  190.     UINT WINAPI WNetCancelConnection(LPTSTR lpszName,
  191.                                      BOOL fForce);
  192.  
  193.     [
  194.     usesgetlasterror,
  195.     entry("WNetConnectionDialog"),
  196.     helpstring("Starts a browsing dialog for connecting to network resources"),
  197.     ]
  198.     UINT WINAPI WNetConnectionDialog(UINT hWnd,
  199.                                      UINT fdwResourceType);
  200.  
  201.  
  202.     [
  203.     usesgetlasterror,
  204.     entry("WNetDisconnectDialog"),
  205.     helpstring("Starts a browsing dialog for disconnecting a network resource"),
  206.     ]
  207.     DWORD WINAPI WNetDisconnectDialog(HWND  hwnd,
  208.                                       DWORD dwType);
  209.  
  210.     const long RESOURCETYPE_ANY         = 0x00000000;
  211.     const long RESOURCETYPE_DISK        = 0x00000001;
  212.     const long RESOURCETYPE_PRINT       = 0x00000002;
  213.     const long RESOURCETYPE_UNKNOWN     = 0xFFFFFFFF;
  214.     const long RESOURCETYPE_RESERVED    = 0x00000008;
  215.  
  216.     const DWORD RESOURCE_CONNECTED     = 0x00000001;
  217.     const DWORD RESOURCE_GLOBALNET     = 0x00000002;
  218.     const DWORD RESOURCE_REMEMBERED    = 0x00000003;
  219.     const DWORD RESOURCE_RECENT        = 0x00000004;
  220.     const DWORD RESOURCE_CONTEXT       = 0x00000005;
  221.  
  222.     const DWORD RESOURCEUSAGE_CONNECTABLE  = 0x00000001;
  223.     const DWORD RESOURCEUSAGE_CONTAINER    = 0x00000002;
  224.     const DWORD RESOURCEUSAGE_NOLOCALDEVICE = 0x00000004;
  225.     const DWORD RESOURCEUSAGE_SIBLING      = 0x00000008;
  226.     const DWORD RESOURCEUSAGE_ALL          = 0x00000003; // RESOURCEUSAGE_CONNECTABLE | RESOURCEUSAGE_CONTAINER
  227.     const DWORD RESOURCEUSAGE_RESERVED     = 0x80000000;
  228.  
  229.     const DWORD RESOURCEDISPLAYTYPE_GENERIC       = 0x00000000;
  230.     const DWORD RESOURCEDISPLAYTYPE_DOMAIN        = 0x00000001;
  231.     const DWORD RESOURCEDISPLAYTYPE_SERVER        = 0x00000002;
  232.     const DWORD RESOURCEDISPLAYTYPE_SHARE         = 0x00000003;
  233.     const DWORD RESOURCEDISPLAYTYPE_FILE          = 0x00000004;
  234.     const DWORD RESOURCEDISPLAYTYPE_GROUP         = 0x00000005;
  235.     const DWORD RESOURCEDISPLAYTYPE_NETWORK       = 0x00000006;
  236.     const DWORD RESOURCEDISPLAYTYPE_ROOT          = 0x00000007;
  237.     const DWORD RESOURCEDISPLAYTYPE_SHAREADMIN    = 0x00000008;
  238.     const DWORD RESOURCEDISPLAYTYPE_DIRECTORY     = 0x00000009;
  239.     const DWORD RESOURCEDISPLAYTYPE_TREE          = 0x0000000A;
  240.  
  241.     //  Network Connections
  242.  
  243.     const int NETPROPERTY_PERSISTENT      = 1;
  244.  
  245.     const DWORD CONNECT_UPDATE_PROFILE     = 0x00000001;
  246.     const DWORD CONNECT_UPDATE_RECENT      = 0x00000002;
  247.     const DWORD CONNECT_TEMPORARY          = 0x00000004;
  248.     const DWORD CONNECT_INTERACTIVE        = 0x00000008;
  249.     const DWORD CONNECT_PROMPT             = 0x00000010;
  250.     const DWORD CONNECT_NEED_DRIVE         = 0x00000020;
  251.     const DWORD CONNECT_REFCOUNT           = 0x00000040;
  252.     const DWORD CONNECT_REDIRECT           = 0x00000080;
  253.     const DWORD CONNECT_LOCALDRIVE         = 0x00000100;
  254.     const DWORD CONNECT_CURRENT_MEDIA      = 0x00000200;
  255.  
  256.     [
  257.     usesgetlasterror,
  258.     #ifdef UNICODE
  259.     entry("WNetAddConnection2W"),
  260.     #else
  261.     entry("WNetAddConnection2A"),
  262.     #endif
  263.     helpstring("Makes a connection to a network resource"),
  264.     ]
  265.     DWORD WINAPI WNetAddConnection2(NETRESOURCE * lpNetResource,
  266.                                     LPCTSTR lpPassword,
  267.                                     LPCTSTR lpUserName,
  268.                                     DWORD dwFlags);
  269.  
  270.     [
  271.     usesgetlasterror,
  272.     #ifdef UNICODE
  273.     entry("WNetAddConnection3W"),
  274.     #else
  275.     entry("WNetAddConnection3A"),
  276.     #endif
  277.     helpstring("Makes a connection to a network resource"),
  278.     ]
  279.     DWORD WINAPI WNetAddConnection3(HWND hwndOwner,
  280.                                     NETRESOURCE * lpNetResource,
  281.                                     LPCTSTR lpPassword,
  282.                                     LPCTSTR lpUserName,
  283.                                     DWORD dwFlags);
  284.  
  285.     [
  286.     usesgetlasterror,
  287.     #ifdef UNICODE
  288.     entry("WNetCancelConnection2W"),
  289.     #else
  290.     entry("WNetCancelConnection2A"),
  291.     #endif
  292.     helpstring("Breaks an existing network connection, or removes remembered connections that are not currently connected"),
  293.     ]
  294.     DWORD WINAPI WNetCancelConnection2(LPCTSTR lpName,
  295.                                        DWORD dwFlags,
  296.                                        BOOL fForce);
  297.  
  298.     [
  299.     usesgetlasterror,
  300.     #ifdef UNICODE
  301.     entry("WNetUseConnectionW"),
  302.     #else
  303.     entry("WNetUseConnectionA"),
  304.     #endif
  305.     helpstring("Establishes connection to a network object, usually for browsing"),
  306.     ]
  307.     DWORD WINAPI WNetUseConnection(HWND hwndOwner,
  308.                                    NETRESOURCE * lpNetResource,
  309.                                    LPCTSTR lpUserID,
  310.                                    LPCTSTR lpPassword,
  311.                                    DWORD dwFlags,
  312.                                    LPTSTR lpAccessName,
  313.                                    DWORD * lpBufferSize,
  314.                                    DWORD * lpResult);
  315.  
  316.     [
  317.     usesgetlasterror,
  318.     #ifdef UNICODE
  319.     entry("WNetSetConnectionW"),
  320.     #else
  321.     entry("WNetSetConnectionA"),
  322.     #endif
  323.     helpstring("Changes the characteristics of a network connection"),
  324.     ]
  325.     DWORD WINAPI WNetSetConnection(LPCTSTR lpName,
  326.                                    DWORD dwProperties,
  327.                                    void * pvValues);
  328.  
  329.     //  Network Connection Dialogs.
  330.  
  331.     const DWORD CONNDLG_RO_PATH    = 0x00000001; // Resource path should be read-only
  332.     const DWORD CONNDLG_CONN_POINT = 0x00000002; // Netware -style movable connection point enabled
  333.     const DWORD CONNDLG_USE_MRU    = 0x00000004; // Use MRU combobox
  334.     const DWORD CONNDLG_HIDE_BOX   = 0x00000008; // Hide persistent connect checkbox
  335.  
  336.     // NOTE:  Set at most ONE of the below flags. If neither flag is set,
  337.     //        then the persistence is set to whatever the user chose during
  338.     //        a previous connection
  339.     const DWORD CONNDLG_PERSIST    = 0x00000010;  // Force persistent connection
  340.     const DWORD CONNDLG_NOT_PERSIST = 0x00000020; // Force connection NOT persistent
  341.  
  342.     [
  343.     usesgetlasterror,
  344.     #ifdef UNICODE
  345.     entry("WNetConnectionDialog1W"),
  346.     #else
  347.     entry("WNetConnectionDialog1A"),
  348.     #endif
  349.     helpstring("Brings up a general browsing dialog for connection to network resources"),
  350.     ]
  351.     DWORD WINAPI WNetConnectionDialog1(CONNECTDLGSTRUCT * lpConnDlgStruct);
  352.  
  353.     const DWORD DISC_UPDATE_PROFILE        = 0x00000001;
  354.     const DWORD DISC_NO_FORCE              = 0x00000040;
  355.  
  356.     [
  357.     usesgetlasterror,
  358.     entry("WNetDisconnectDialog1"),
  359.     helpstring("Disconnects a network resource, prompting for confirmation if files are open"),
  360.     ]
  361.     DWORD WINAPI WNetDisconnectDialog1(DISCDLGSTRUCT * lpConnDlgStruct);
  362.  
  363.     //  Network Browsing.
  364.  
  365.     [
  366.     usesgetlasterror,
  367.     #ifdef UNICODE
  368.     entry("WNetOpenEnumW"),
  369.     #else
  370.     entry("WNetOpenEnumA"),
  371.     #endif
  372.     helpstring("Starts an enumeration of network resources or existing connections"),
  373.     ]
  374.     DWORD WINAPI WNetOpenEnum(
  375.          DWORD          dwScope,
  376.          DWORD          dwType,
  377.          DWORD          dwUsage,
  378.          NETRESOURCE *  lpNetResource,
  379.          HANDLE *      lphEnum
  380.         );
  381.  
  382.    [
  383.    usesgetlasterror,
  384.    #ifdef UNICODE
  385.    entry("WNetEnumResourceW"),
  386.    #else
  387.    entry("WNetEnumResourceA"),
  388.    #endif
  389.    helpstring("Continues a network-resource enumeration started WNetOpenEnum"),
  390.    ]
  391.    DWORD WINAPI WNetEnumResource(
  392.         HANDLE  hEnum,
  393.         DWORD * lpcCount,
  394.         void * lpBuffer,
  395.         DWORD * lpBufferSize
  396.        );
  397.  
  398.    [
  399.    usesgetlasterror,
  400.    entry("WNetCloseEnum"),
  401.    helpstring("Ends a network resource enumeration started by WNetOpenEnum"),
  402.    ]
  403.    DWORD WINAPI WNetCloseEnum(HANDLE   hEnum);
  404.  
  405.    //  Universal Naming.
  406.  
  407.    const DWORD UNIVERSAL_NAME_INFO_LEVEL  = 0x00000001;
  408.    const DWORD REMOTE_NAME_INFO_LEVEL     = 0x00000002;
  409.     
  410.    [
  411.    usesgetlasterror,
  412.    #ifdef UNICODE
  413.    entry("WNetGetUniversalNameW"),
  414.    #else
  415.    entry("WNetGetUniversalNameA"),
  416.    #endif
  417.    helpstring("Takes a drive-based path for a network resource and obtains a data structure that contains a more universal form of the name"),
  418.    ]
  419.    DWORD WINAPI WNetGetUniversalName(
  420.         LPCTSTR lpLocalPath,
  421.         DWORD    dwInfoLevel,
  422.         void * lpBuffer,
  423.         DWORD  * lpBufferSize
  424.         );
  425.  
  426.    // Other
  427.  
  428.    const WORD WNFMT_MULTILINE        = 0x01;
  429.    const WORD WNFMT_ABBREVIATED      = 0x02;
  430.    const WORD WNFMT_INENUM           = 0x10;
  431.    const WORD WNFMT_CONNECTION       = 0x20;
  432.  
  433.     [
  434.     usesgetlasterror,
  435.     #ifdef UNICODE
  436.     entry("WNetGetProviderNameW"),
  437.     #else
  438.     entry("WNetGetProviderNameA"),
  439.     #endif
  440.     helpstring("Obtains the provider name for a specific type of network"),
  441.     ]
  442.     DWORD WINAPI WNetGetProviderName(
  443.        DWORD   dwNetType,
  444.        LPTSTR lpProviderName,
  445.        DWORD * lpBufferSize
  446.        );
  447.  
  448.     const DWORD NETINFO_DLL16      = 0x00000001;  // Provider running as 16 bit Winnet Driver
  449.     const DWORD NETINFO_DISKRED    = 0x00000004;  // Provider requires disk redirections to connect
  450.     const DWORD NETINFO_PRINTERRED = 0x00000008;  // Provider requires printer redirections to connect
  451.  
  452.     [
  453.     usesgetlasterror,
  454.     #ifdef UNICODE
  455.     entry("WNetGetNetworkInformationW"),
  456.     #else
  457.     entry("WNetGetNetworkInformationA"),
  458.     #endif
  459.     helpstring("Gets extended information about a network whose name was returned by a network enumeration"),
  460.     ]
  461.     DWORD WINAPI WNetGetNetworkInformation(
  462.        LPCTSTR lpProvider,
  463.        NETINFOSTRUCT * lpNetInfoStruct
  464.        );
  465.  
  466.    //  User Profiles
  467.  
  468.    const WORD RP_LOGON   = 0x01;  // if set, do for logon, else for logoff
  469.    const WORD RP_INIFILE = 0x02;  // if set, reconcile .INI file, else reg. hive
  470.  
  471.    //  Policies.
  472.  
  473.    const WORD PP_DISPLAYERRORS   = 0x01;    // if set, display error messages, else fail silently if error
  474.  
  475.  
  476.     //  Error handling.
  477.  
  478.     [
  479.     usesgetlasterror,
  480.     #ifdef UNICODE
  481.     entry("WNetGetLastErrorW"),
  482.     #else
  483.     entry("WNetGetLastErrorA"),
  484.     #endif
  485.     helpstring("Retrieves the most recent extended error code set by a Windows network function"),
  486.     ]
  487.     DWORD WINAPI WNetGetLastError(
  488.         DWORD * lpError,
  489.         LPTSTR lpErrorBuf,
  490.         DWORD nErrorBufSize,
  491.         LPTSTR lpNameBuf,
  492.         DWORD nNameBufSize);
  493.  
  494.     //  For Shell
  495.  
  496.     const DWORD WNCON_FORNETCARD       = 0x00000001;
  497.     const DWORD WNCON_NOTROUTED        = 0x00000002;
  498.     const DWORD WNCON_SLOWLINK         = 0x00000004;
  499.     const DWORD WNCON_DYNAMIC          = 0x00000008;
  500.  
  501.     [
  502.     usesgetlasterror,
  503.     #ifdef UNICODE
  504.     entry("MultinetGetConnectionPerformanceW"),
  505.     #else
  506.     entry("MultinetGetConnectionPerformanceA"),
  507.     #endif
  508.     helpstring("Gets performance information about a network connection"),
  509.     ]
  510.     DWORD WINAPI MultinetGetConnectionPerformance(
  511.         NETRESOURCE * lpNetResource,
  512.         NETCONNECTINFOSTRUCT * lpNetConnectInfoStruct);
  513.  
  514. };
  515.